package com.lijz.log;

import java.util.concurrent.Callable;

public class LogCallable implements Callable<Object> {
	private String userId;
	private String token;
	private SysLog log;
	private Long timeStamp;
	private int type;
	private String logId;
	private ILogService logService;


	public LogCallable(SysLog log, String logId,ILogService logService) {
		this.log = log;
		this.logId = logId;
		this.type = 2;
		this.logService = logService;
	}

	public LogCallable(String userId, String token, SysLog log, Long timeStamp,ILogService logService) {
		this.userId = userId;
		this.token = token;
		this.log = log;
		this.timeStamp = timeStamp;
		this.type = 1;
		this.logService = logService;
	}

	@Override
	public Object call() throws Exception {
		if (type == 1) {//写
			return logService.writeLog(userId, token, log, timeStamp);
		} else if (type == 2) {//更新
			logService.updateLog(logId, log);
			return "";
		} else {//获取

		}
		return "";
	}
}
